﻿<%@ Page Title="" Language="C#" MasterPageFile="~/MainFrm.Master" AutoEventWireup="true" CodeBehind="ProjectAdd.aspx.cs" Inherits="Ewts.Project.ProjectAdd" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
<script type="text/javascript">
    function SetCumname(cumtype, txtname) {
        var param = "?cumtype=" + cumtype + "&cumid=" + $(".hidcumid").val();
        $.ajax({
            type: "post",
            url: "/ashx/basicData.ashx" + param,
            data: "text",
            success: function (msg) {
                $("." + txtname).val(msg);
            }
        });
      }

      $(document).ready(function () {

          $(".txtOtherCjo").keyup(function () {
              var name = $(".txtOtherCjo").val();
              $(".txtCjoName").val(name);
          });


          $(".txtOtherPrint").keyup(function () {
              var name = $(".txtOtherPrint").val();
              $(".txtPrintName").val(name);
          });


          $(".txtOtherLab").keyup(function () {
              var name = $(".txtOtherLab").val();
              $(".txtLabName").val(name);
          });


          $("input[name='cjo']").click(function () {
              var ntype;
              ntype = $(this).val();
              if (ntype == "other") {
                  $(".txtOtherCjo").removeAttr("disabled");
                  $(".txtCjoName").val("");
              }
              else {
                  $(".txtOtherCjo").attr("disabled", "disabled");
                  SetCumname($(this).val(),"txtCjoName");
              }
          });

          $("input[name='print']").click(function () {
              var ntype;
              ntype = $(this).val();
              if (ntype == "other") {
                  $(".txtOtherPrint").removeAttr("disabled");
                  $(".txtPrintName").val("");
              }
              else {
                  $(".txtOtherPrint").attr("disabled", "disabled");
                  SetCumname($(this).val(), "txtPrintName");
              }
          });

          $("input[name='lab']").click(function () {
              var ntype;
              ntype = $(this).val();
              if (ntype == "other") {
                  $(".txtOtherLab").removeAttr("disabled");
                  $(".txtLabName").val("");
              }
              else {
                  $(".txtOtherLab").attr("disabled", "disabled");
                  SetCumname($(this).val(), "txtLabName");
              }
          });
      });
</script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="EwtsConext" runat="server">
    <div id="mainRight">
<h1 class="title">项目管理</h1>
        <div>
          <input type="hidden" runat="server" id="hidcumid" class="hidcumid" />
          <div id="content">
            <div class="box content">
              <table cellpadding="0" cellspacing="0" class="forms" style="width:100%;">
              <%--  <caption>新增项目</caption>--%>
                <tr>
	                    <td>
                            <label><span class="required">*</span>项目名称：</label>
                         </td>
                         <td>
		                    <asp:TextBox id="txtProjectName" runat="server" Enabled="true"></asp:TextBox>
	                    </td>
                </tr>
                <tr>
                    <td>
                        <label><span class="required">*</span>归属地区：</label>
                    </td>
                    <td>
                        <asp:DropDownList ID="serverPoint" runat="server" Width="100px">
                        </asp:DropDownList>
                    </td>
                </tr>
                <tr>
                    <td>
                        *CJO显示客户名称：
                    </td>
                    <td id="tdcjoName">
                        <input runat="server" id="txtCjoName" class="txtCjoName" />
                        <input type="radio" name="cjo" value="all" /> 客户全称
                        <input type="radio" name="cjo" value="short" /> 客户简称
                        <input type="radio" name="cjo" value="code" /> 客户编码
                        <input type="radio" name="cjo" value="other" /> 其他简称 
                              <input runat="server" id="txtOtherCjo" disabled="disabled" class="txtOtherCjo" />
                    </td>

                </tr>
               <tr>
                    <td>
                        *打印单显示客户名称：
                    </td>
                    <td id="tdPrintNamw">
                        <input runat="server" id="txtPrintName" class="txtPrintName" />
                        <input type="radio" name="print" value="all"  /> 客户全称
                        <input type="radio" value="short" name="print"  /> 客户简称
                        <input type="radio" value="code" name="print"  /> 客户编码
                        <input type="radio" value="other" name="print"  /> 其他简称 
                                <input runat="server" id="txtOtherPrint" disabled="disabled" class="txtOtherPrint" />
                    </td>

                </tr>
               <tr>
                    <td>
                        *标签显示客户名称：
                    </td>
                    <td id="tdprintNamw">
                        <input runat="server" id="txtLabName" class="txtLabName" />
                        <input type="radio" name="lab" checked="checked" value="all" /> 客户全称
                        <input type="radio" name="lab" value="short"  /> 客户简称
                        <input type="radio" name="lab" value="code" /> 客户编码
                        <input type="radio" name="lab" value="other" /> 其他简称 
                                <input runat="server" id="txtOtherLab" disabled="disabled" class="txtOtherLab" />
                    </td>

                </tr>

                <tr>
                    <td>
                    </td>
                    <td><asp:Button ID="Button1"
                          runat="server" Text="添加项目" onclick="Button1_Click" /></td>
                </tr>
              </table>
            </div>   
            <table id="tbprject" cellpadding="0" cellspacing="0" border="0" class="display">
              <thead>
                <tr>
                  <th class="serialNumber">序号</th>
                  <th>项目名称</th>
                  <th>项目编号</th>
                  <th>客户名称</th>
                  <th>CJO显示客户名称</th>
                  <th>打印单显示客户名称</th>
                  <th>标签显示客户名称</th>
                  <th>归属</th>
                  <th>操作</th>
                </tr>
              </thead>
              <tbody>
                <asp:Repeater ID="rept" runat="server" OnItemCommand="BtnDel_Click">
                <ItemTemplate>
                <tr style=" text-align:center;">
                  <td><%#Container.ItemIndex+1 %></td>
                  <td><%# Eval("ProjectName") %></td>
                  <td><%# Eval("ProjectNum")%></td>
                  <td><%# GetCumName(Eval("CustomerID").ToString())%></td>
                  <td><%# Eval("cjoname")%></td>
                  <td><%# Eval("printname")%></td>
                  <td><%# Eval("labname")%></td>
                  <td><%# Eval("belongAddress")%></td>
                  <td>
                    <a href="AreaList.aspx?id=<%# Eval("ProjectID") %>">服务区域管理</a>&nbsp
                    <a href="ProjectAdd.aspx?cumid=<%#Eval("CustomerID") %>&ProjectID=<%#Eval("ProjectID") %>">编辑项目</a>&nbsp
                    <asp:LinkButton ID="LinkBtnDel" OnClientClick="return confirm('确定要删除吗?')" CommandName='<%# Eval("ProjectID") %>' runat="server">删除项目</asp:LinkButton>
                  </td>
                </tr>
                </ItemTemplate>              
                </asp:Repeater>
              </tbody>       
            </table>                        
          </div> 
        </div> 
      </div>
         <script type="text/javascript">
             $(document).ready(function () {
                 $('#tbprject').dataTable({ "oLanguage":
                 { "sUrl": "/jquery/jquery.dataTable.cn.txt" },
                     "bJQueryUI": true,
                     "sPaginationType": "full_numbers",
                     'bPaginate': true,
                     "bProcessing": true,
                     "iDisplayLength": 20,
                     "bSort": true,
                     "aaSorting": [[0, "desc"]]
                 });

             });
 
</script>
</asp:Content>
